package com.situ.ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.ssm.entity.Result;
import com.situ.ssm.entity.User;
import com.situ.ssm.service.IUserService;

@Controller
@RequestMapping("/user")
public class UserController {
	@Autowired
	private IUserService userService;

	@RequestMapping("/login")
	@ResponseBody
	public Result login(String name, String password) {
		System.out.println("UserController.login()");
		System.out.println("name: " + name + ", password: " + password);
		User user = userService.login(name, password);
		
		// Result result = new Result(1, "登录成功");
		if (user != null) {
			return Result.success("登录成功");
		} else {
			return Result.error("登录失败");
		}
	}
	
	
	
	
	
	
	
}
